/*
 * p4438.cpp
 *
 *  Created on: 2013-10-23
 *      Author: zy
 */
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
//double solve(int n,double p)
//{
//	double ans=n*p;
//	double last=1;
//	for(int m=n+1;m<=2*n;m++)
//	{
//		last*=(1-p)*m/(m-n)*p;
//		ans+=last*(2*n-m);
//		ans*=p;//保证了所有的概率都乘了n+1次的p
//	}
//	return ans;
//}
double solve(int n, double p)
{
	double Q = log(1 - p);
	double P=log(p)*(n+1);
	double last = 0;
	double ans =n*exp(P);
	for (int m = n + 1; m <= 2 * n; m++)
	{
		last += log(m) - log(m - n);
		ans += exp(P+last + (m - n) * Q + log(2 * m - n));
	}
	printf("%f\n",ans);
	return ans;
}
int main()
{
	int n;
	int cas = 0;
	while (scanf("%d", &n) != EOF)
	{
		double p;
		scanf("%lf", &p);
		printf("Case %d: %0.6lf\n", ++cas, solve(n, p) + solve(n, 1 - p));
	}
//	printf("%lf\n",exp(log(10)));
	return 0;
}
